<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="html" 
			doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
			doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
	
	<xsl:template match="/">
		<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<title>SQL2XML - BOULINGUEZ &amp; CHENG</title>
				<link rel="stylesheet" type="text/css" href="ressources/sql2xml.css"/>
			</head>
			<body>
				<div id="page">
					<img src="ressources/img/baniere_cmd.jpg" alt="logo sql2xml"/>
					<h1>SQL2XML - BOULINGUEZ &amp; CHENG</h1>
					<br/>
					<a id="btn_return" href="/SQL2XML2/Recherche">Nouvelle recherche</a>
					<br/><br/>
					<xsl:choose>
						<xsl:when test="ResultatRecherche/RForum">
							<h2>Liste des forums</h2>
							<table id="listeQuestions">
								<thead>
									<tr>
										<th>Sujet</th>
										<th>Date</th>
										<th>Résolu</th>
										<th>Auteur</th>
									</tr>
								</thead>
								<tbody>
								<xsl:for-each select="ResultatRecherche/RForum/Question">
								<tr>
									<td><a href="Question?idQuestion={@idQuestion}"><xsl:value-of select="Sujet"/></a></td>
									<td><a href="Question?idQuestion={@idQuestion}"><xsl:value-of select="DateCreation"/></a></td>
									<td valign="middle"><a href="Question?idQuestion={@idQuestion}">
										<xsl:if test="Resolu='true'">
											<img border="no" src="ressources/img/resolu_20.png" alt="Resolu" title="Sujet résolu"/>
										</xsl:if>
										<xsl:if test="Resolu='false'">
											<img border="no" src="ressources/img/ouvert_20.png" alt="Ouvert" title="Sujet ouvert"/>
										</xsl:if>
									</a></td>
									<td><a href="Question?idQuestion={@idQuestion}"><xsl:value-of select="EmailUtilisateur"/></a></td>
								</tr>
								</xsl:for-each>
								</tbody>
							</table>
							<xsl:choose>
								<xsl:when test="ResultatRecherche/RForum/Message">
									<div id="errMsg">
										<br/>
										<center><xsl:value-of select="ResultatRecherche/RForum/Message"/></center>
									</div>
								</xsl:when>
							</xsl:choose>
						</xsl:when>
					</xsl:choose>
					<br/>
					<xsl:choose>
						<xsl:when test="ResultatRecherche/RCours">
							<h2>Liste des cours</h2>
							<table id="listeCours">
							<thead>
									<tr>
										<th>Titre</th>
										<th>Date</th>
										<th>Votes</th>
										<th>URL</th>
									</tr>
								</thead>
								<tbody>
								<xsl:for-each select="ResultatRecherche/RCours/Cours">
									<tr>
										<td><a href="{URL}" target="_blank"><xsl:value-of select="Titre"/></a></td>
										<td><a href="{URL}" target="_blank"><xsl:value-of select="DateCreation"/></a></td>
										<td><a href="{URL}" target="_blank"><xsl:value-of select="Votes"/></a></td>
										<td><a href="{URL}" target="_blank">Consulter ce cours</a></td>
									</tr>
								</xsl:for-each>
								</tbody>
							</table>
							<xsl:choose>
								<xsl:when test="ResultatRecherche/RCours/Message">
									<div id="errMsg">
										<br/>
										<center><xsl:value-of select="ResultatRecherche/RCours/Message"/></center>
									</div>
								</xsl:when>
							</xsl:choose>
						</xsl:when>
					</xsl:choose>
            	</div>
				<div id="copyright">&#169;2011 sql2xml tous droits réservés <br/> BOULINGUEZ &amp; CHENG</div>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>